package com.warm.androidstudy.utils;

import android.util.TypedValue;

import com.warm.androidstudy.MyApplication;


/**
 * <pre>
 *     author : guosenlin
 *     e-mail : guosenlin91@gmail.com
 *     time   : 2021/02/24
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class DensityUtil {

    public static int dp2px(int dp){

        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, dp, MyApplication.getInstance().getResources().getDisplayMetrics());
    }
}
